import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

@pytest.fixture
def driver():
    driver = webdriver.Edge()
    driver.maximize_window()
    driver.get('http://10.59.9.12:7001/')
    yield driver
    driver.quit()

def test_A3mall_01(driver):
    #点击登录
    driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
    #断言登录页面
    dy1 = driver.find_element(By.XPATH,'/html/body/div[4]/div/div[1]/div[1]/span[1]').text
    print(dy1)
    sleep(3)
    #输入账号
    # driver.find_element(By.XPATH,'//input[@class="regi-input"]and name="username"').send_keys('lkx')
    driver.find_element(By.NAME,'username').send_keys('lkx')
    sleep(3)
    # driver.find_element(By.XPATH,'//input[@class="regi-input"] or name = "password"').send_keys('123456')
    driver.find_element(By.NAME,'password').send_keys('123456')
    sleep(10)
    driver.find_element(By.XPATH,'//a[@class="finish-btn"]').click()
    sleep(5)
    # 断言登录成功页面
    dy2 = driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').text
    print(dy2)
    sleep(3)
